#pragma once
#include <game/Config.h>
#include <game/services/DelayedActions.h>
#include <vector>
#include <CompilerFeatures.h>
#include <boost/function.hpp>

ARELLO_GAME_NAMESPACE_DECL_START

class DelayedActionServiceImpl
	: public services::DelayedActions
{
public:
	DelayedActionServiceImpl();
	~DelayedActionServiceImpl();

	virtual void Schedule(boost::function<void ()> action) LIBA_OVERRIDE;
	virtual void ScheduleDeferred(time_float delay, boost::function<void ()> action) LIBA_OVERRIDE;

	void Perform(time_float dt);
private:
	typedef std::vector<std::pair<time_float, boost::function<void ()> > > DelayedActionsVector;
	DelayedActionsVector delayedActions;
};

ARELLO_GAME_NAMESPACE_DECL_END